package com.edu.zju.scs.panacea.utils;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Yue Liang
 * @Date: 2019-01-05 11:38
 */
public class CmdUtil {
    public static List<String> executeCmdReturnList(String cmd) throws Exception{
        List<String> result=new ArrayList<>();
        Runtime rt = Runtime.getRuntime();
        Process pr = rt.exec("python /Users/mzq/Desktop/count.py");
        BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "utf-8"));
        String line = null;
        while ((line = input.readLine()) != null) {
            result.add(line);
        }
        return result;
    }

    public static void executeCmd(String cmd) throws Exception{
        Runtime runtime=Runtime.getRuntime();
        runtime.exec("cmd /c "+cmd);
    }

    public static void main(String[] args) throws Exception {
        System.out.println(CmdUtil.executeCmdReturnList(""));
    }

}
